<?php $this->Html->addCrumb('Offices', '/Offices'); ?>
<?php $this->Html->addCrumb($office['Office']['o_name']); ?>
<div class="actions">
	<h3><?php echo __('Actions'); ?></h3>
	<ul>
		<li>
		<?php echo $this->Html->image('buttons/edit-button-35px.png', array(
        															'alt'=>'Edit',
																	'height' => '50px',
																	'width' => '50px',
        															'url'=> array(
        																	'controller' => 'Offices',
        																	'action' => 'edit',
        																	$office['Office']['o_id']
        																	)
        																)
        															); ?>

		</li>

		<li>

<?php echo $this->Form->postLink($this->Html->image('buttons/delete-button-35px.png', array(
															'height' => '50px',
															'width' => '50px',
															'alt'=>'delete')),

															array(
															'controller' => 'offices',
															'action' => 'delete',
															$office['Office']['o_id']),
															array(
															'escape' => false,
                                                            'confirm' => 'Are you sure you want to delete this office on %s?')
                                                            );?>
</li>

		<li>

<?php echo $this->Html->image('buttons/add-button-50px.png', array(
															'alt'=>'Add',

															'url'=> array('controller' => 'interactions', 'action' => 'add', '?' => array( 'office' => h($office['Office']['o_id']))
																)
															)); ?>
															</li>
	</ul>
</div>

<div class="officesView">
<h2><?php  echo __('Office'); ?></h2>
	<table>
		<tr>
			<th>Name</th>
			<td><?php echo h($office['Office']['o_name']); ?></td>
		</tr>
		<tr>
			<th>Address</th>
			<td><?php echo h($office['Office']['o_address']); ?></td>
		</tr>
		<tr>
			<th>Postcode</th>
			<td><?php echo h($office['Office']['o_postcode']); ?></td>
		</tr>
		<tr>
			<th>Phone Number</th>
			<td><?php echo h($office['Office']['o_phone']); ?></td>
		</tr>
		<tr>
			<th>Email</th>
			<td><a href="<?php echo 'mailto:'.h($office['Office']['o_email']); ?>"/><?php echo h($office['Office']['o_email']); ?></a></td>
		</tr>
	</table>
</div>

<div class="related">
	<h3><?php echo __('Interaction History'); ?></h3>
	<?php if (!empty($office['Interaction'])): ?>
	<table cellpadding = "0" cellspacing = "0">
	<tr>
		<th><?php echo __('Date'); ?></th>
		<th><?php echo __('Type'); ?></th>
		<th><?php echo __('Details'); ?></th>
		<th><?php echo __('Employee'); ?></th>
		<th class="actions"><?php echo __('Actions'); ?></th>
	</tr>
	<?php
		$i = 0;
		foreach ($office['Interaction'] as $interaction): ?>
		<tr>
			<td><?php echo $interaction['i_date']; ?></td>
			<td><?php echo $interaction['int_type']['type_name']; ?></td>
			<td><?php echo $interaction['i_details']; ?></td>
			<td><?php echo $interaction['Employee']['e_fname']; ?></td>
			<td class="actions">
				<?php echo $this->Html->image('buttons/view-button-35px.png', array(
															'alt'=>'View',
															'url'=> array(
																	'controller' => 'interactions',
																	'action' => 'view',
																	$interaction['i_id']
																	)
																)
															); ?>
				<?php echo $this->Html->image('buttons/edit-button-35px.png', array(
															'alt'=>'Edit',
															'url'=> array(
																	'controller' => 'interactions',
																	'action' => 'edit',
																	$interaction['i_id']
																	)
																)
															); ?>
				
				<?php echo $this->Form->postLink(
							$this->Html->image('buttons/delete-button-35px.png',array(
																'alt'=>'Delete')
															),
															array(
															'controller' => 'interactions',
															'action' => 'delete',
															$interaction['i_id']),
															array(
															'escape' => false,
															'confirm' => 'Are you sure you want to delete this interaction on %s?', $interaction['i_date'])
															); ?>
			</td>
		</tr>
	<?php
	$i++;
	endforeach; ?>
	</table>
<?php endif; ?>

	
</div>
